package com.rayboo.config;

import java.util.List;
import java.util.Map;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import javax.servlet.ServletContext;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.rayboo.service.MenuService;


@Component
public class Setup {
	@Autowired
	private ServletContext servletContext;

	@Autowired
	private MenuService menuService;

	@PostConstruct
	public void init() {
		List<Map<String, Object>> menus = menuService.getMenus();
		servletContext.setAttribute("menus", menus);
	}

	@PreDestroy
	public void teardown() {
	}
}
